<template>
  <div class="colorRowCon">
    <div v-for="(item, index) in value" class="item" :key="index">
      <div :class="'line' + index" :style="lineStyle"></div>
      <div v-for="(tabItem, id) in item.dataArr" :key="id" class="itemTabs">
        <div class="tabItem">
          <div class="tabItemTop" :style="tabNameStyle">
            {{tabItem.name}}
          </div>
          <div class="tabItemBot" :style="tabNumStyle">
            <i-count-up :startVal="startVal" :endVal="tabItem.value" :decimals="tabItem.decimals ? tabItem.decimals : decimals" :duration="duration" :options="options" />
            <span class="unit" :style="unitStyle">{{item.unit}}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
/**
   * value 传入格式 如下
   * var arr = [
        {
          dataArr: [
            {
              name: "房源跟进",
              value: 49
            },
            {
              name: "客源跟进",
              value: 49
            }
          ],
          unit: "家"
        },
        {
          dataArr: [
            {
              name: "房源实勘",
              value: 65
            }
          ],
          unit: "家"
        },
        {
          dataArr: [
            {
              name: "客户带看",
              value: 81
            }
          ],
          unit: "家"
        },
        {
          dataArr: [
            {
              name: "钥匙",
              value: 81
            }
          ],
          unit: "家"
        }
      ];
   */
export default {
  props: {
    unitStyle: {
      // 单位字体样式
      type: String,
      default: () => {
        return "";
      }
    },
    value: {
      type: Array,
      default: () => {
        return [];
      }
    },
    lineStyle: {
      type: String,
      default: () => {
        return "";
      }
    },
    tabNameStyle: {
      type: String,
      default: () => {
        return "";
      }
    },
    tabNumStyle: {
      type: String,
      default: () => {
        return "";
      }
    }
  },
  data() {
    return {
      startVal: 0,
      decimals: 0,
      duration: 2.5,
      options: {
        useEasing: true,
        useGrouping: true,
        separator: ",",
        decimal: ".",
        prefix: "",
        suffix: ""
      }
    };
  }
};
</script>

<style lang="scss" scoped>
@import "../../../../../../styles/base/_parameters";
.colorRowCon {
  padding: 10px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 62%;
  .item {
    display: flex;
    .line0 {
      position: relative;
      width: 20px;
      height: 130px;
      background: rgba(253, 196, 9, 0.5);
      box-shadow: 0px 0px 15px #fdc409 inset;
      border: 1px solid #fdc409;
    }
    .line0::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      box-shadow: 0px 0px 15px #fdc409;
    }
    .line1 {
      position: relative;
      width: 20px;
      height: 130px;
      background: rgba(43, 232, 81, 0.5);
      box-shadow: 0px 0px 15px #2be851 inset;
      border: 1px solid #2be851;
    }
    .line1::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      box-shadow: 0px 0px 15px #2be851;
    }
    .line2 {
      position: relative;
      width: 20px;
      height: 130px;
      background: rgba(30, 193, 255, 0.5);
      box-shadow: 0px 0px 15px #1ec1ff inset;
      border: 1px solid #1ec1ff;
    }
    .line2::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      box-shadow: 0px 0px 15px #1ec1ff;
    }
    .line3 {
      position: relative;
      width: 20px;
      height: 130px;
      background: rgba(255, 97, 74, 0.5);
      box-shadow: 0px 0px 15px #ff614a inset;
      border: 1px solid #ff614a;
    }
    .line3::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      box-shadow: 0px 0px 15px #ff614a;
    }
    .itemTabs {
      display: flex;
      justify-content: space-around;
      align-items: center;
      padding: 0 30px;
      .tabItem {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: flex-start;
        .tabItemTop {
          font-size: 24px;
          color: #fff;
        }
        .tabItemBot {
          @include din(75px);
          color: #55eda7;
          line-height: 135px;
          .unit {
            font-size: 22px;
          }
        }
      }
    }
  }
}
</style>